
        /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.sisportaria.bean;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author lac
 */
@Entity
@Table(name = "NIVEL_ACESSO")
@NamedQueries({@NamedQuery(name = "NivelAcesso.findAll", query = "SELECT n FROM NivelAcesso n"), @NamedQuery(name = "NivelAcesso.findByNancodg", query = "SELECT n FROM NivelAcesso n WHERE n.nancodg = :nancodg"), @NamedQuery(name = "NivelAcesso.findByNancodgps", query = "SELECT n FROM NivelAcesso n WHERE n.nancodgps = :nancodgps"), @NamedQuery(name = "NivelAcesso.findByNacnommod", query = "SELECT n FROM NivelAcesso n WHERE n.nacnommod = :nacnommod"),
    @NamedQuery(name = "NivelAcesso.findByNomeModulo", query = "SELECT n FROM NivelAcesso n WHERE n.nacnommod = :nacnommod"),
    @NamedQuery(name = "NivelAcesso.findByCodigo", query = "SELECT n FROM NivelAcesso n WHERE n.nancodg = :nancodg"),
    @NamedQuery(name = "NivelAcesso.verifiqueAcesso", query = "SELECT n FROM NivelAcesso n WHERE n.nancodgps = :nancodgps and n.nacnommod = :nacnommod")

})
public class NivelAcesso implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "NANCODG")
    private Integer nancodg;
    @Column(name = "NANCODGPS")
    private Integer nancodgps;
    @Column(name = "NACNOMMOD")
    private String nacnommod;

    public NivelAcesso() {
    }

    public NivelAcesso(Integer nancodg) {
        this.nancodg = nancodg;
    }

    public Integer getNancodg() {
        return nancodg;
    }

    public void setNancodg(Integer nancodg) {
        Integer oldNancodg = this.nancodg;
        this.nancodg = nancodg;
        changeSupport.firePropertyChange("nancodg", oldNancodg, nancodg);
    }

    public Integer getNancodgps() {
        return nancodgps;
    }

    public void setNancodgps(Integer nancodgps) {
        Integer oldNancodgps = this.nancodgps;
        this.nancodgps = nancodgps;
        changeSupport.firePropertyChange("nancodgps", oldNancodgps, nancodgps);
    }

    public String getNacnommod() {
        return nacnommod;
    }

    public void setNacnommod(String nacnommod) {
        String oldNacnommod = this.nacnommod;
        this.nacnommod = nacnommod;
        changeSupport.firePropertyChange("nacnommod", oldNacnommod, nacnommod);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nancodg != null ? nancodg.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NivelAcesso)) {
            return false;
        }
        NivelAcesso other = (NivelAcesso) object;
        if ((this.nancodg == null && other.nancodg != null) || (this.nancodg != null && !this.nancodg.equals(other.nancodg))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.sisportaria.view.NivelAcesso[nancodg=" + nancodg + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
